package com.innext.kjqb.ui.my.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.innext.kjqb.widget.recycler.BaseRecyclerAdapter;
import com.innext.kjqb.R;
import com.innext.kjqb.ui.my.bean.CouponBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by gyl on 2017/5/13 0013.
 */

public class CouponAdapter extends BaseRecyclerAdapter<CouponAdapter.ViewHolder, CouponBean.ItemBean> {
    @Override
    public ViewHolder mOnCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mInflater.inflate(R.layout.coupon_item_list, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void mOnBindViewHolder(ViewHolder holder, int position) {
        holder.mTvEndDeadline.setText("有效期：" + data.get(position).getEndDeadline());
        holder.mTvDescribe.setText(data.get(position).getDescribe());
        holder.mTvCouponName.setText(data.get(position).getCouponName());
        holder.mTvMoney.setText(data.get(position).getFaceValue());
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_money)
        TextView mTvMoney;
        @BindView(R.id.tv_coupon_name)
        TextView mTvCouponName;
        @BindView(R.id.tv_describe)
        TextView mTvDescribe;
        @BindView(R.id.tv_end_deadline)
        TextView mTvEndDeadline;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
